package com.project.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.ClientBean;
import com.project.bean.SuppliersBean;
import com.project.mapper.IClientMapper;
import com.project.mapper.ISuppliersMapper;
import com.project.service.IClientService;
import com.project.service.ISuppliersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ClientServiceImpl implements IClientService {

    @Autowired
    private IClientMapper mapper;//报错显示，没有写mapper注解

    @Override
    public PageInfo<ClientBean> findByItem(int page, int pageSize, String clientName, String clientRange) {
        PageHelper.startPage(page,pageSize);
        PageInfo<ClientBean>pageInfo=PageInfo.of(mapper.findByItem(clientName, clientRange));
        return pageInfo;
    }

    @Override
    public void addClient(ClientBean client) {
        mapper.addClient(client);
    }

    @Override
    public ClientBean findById(int id) {
        return mapper.findById(id);
    }

    @Override
    public void updateClient(int id, String clientManager, String clientPhone, String clientRange) {
        mapper.updateClient(id, clientManager, clientPhone, clientRange);
    }
}
